package com.bw.sparksql1.job2

import com.bw.sparksql1.job1.{Job11, Job12}
import org.apache.log4j.{Level, Logger}
import org.apache.spark.sql.SparkSession
/**
  *
  * UDAF 代码测试
  */
object Job1 {
  def main(args: Array[String]): Unit = {
    Logger.getLogger("org").setLevel(Level.ERROR)
    val spark = SparkSession.builder()
      .appName(this.getClass.getSimpleName)
      .master("local")
      .getOrCreate()

    spark.udf.register("avg_sal",Job12)
    spark.sql("select avg_sal(salary) from sqoop_db.products").show()
  }
}
